package data.framework.web.widget;

import javax.servlet.jsp.tagext.TagSupport;
/**
 * 类名
 * @author Administrator
 *
 */
public class PurviewTag extends TagSupport{
	private static final long serialVersionUID = 1L;

	private String visible = "";
	private String invisible = "";
	
	public int doStartTag() {
		
		if((visible == null || "".equals(visible)) && (invisible == null || "".equals(invisible)) ){
			return EVAL_PAGE;
		}
		String requestTag = (String)pageContext.getSession().getAttribute("MEMBER_TYPE");
		if(requestTag == null || "".equals(requestTag)){
			return SKIP_BODY;
		}
		String[] visibles = visible.split(",");
		String[] invisibles = invisible.split(",");
		
		for(String visibleTag : visibles){
			if(requestTag.indexOf(visibleTag) > -1){
				return EVAL_PAGE;
			}
		}
		for(String invisibleTag : invisibles){
			if(requestTag.indexOf(invisibleTag) > -1){
				return SKIP_BODY;
			}
		}
		return EVAL_PAGE;
	}

	public String getVisible() {
		return visible;
	}

	public void setVisible(String visible) {
		this.visible = visible;
	}

	public String getInvisible() {
		return invisible;
	}

	public void setInvisible(String invisible) {
		this.invisible = invisible;
	}
	
	
}
